package com.sc.nft.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

@AllArgsConstructor
@Getter
public enum AssetChangeLogEnum {
    USER_REGIST(1,"用户注册",true),
    REAL_NAME(2,"认证成功",true),
    FIRST_CONSUMPTION (3,"首次消费",true),
    CONSUMPTION_INTEGRAL(4,"消费对应等比积分",true),
    INVITE_NEW_USER (5,"邀新好友送积分",true),
    GOODS_EXCHANGE(11,"积分兑换商品",false),
    EXCHANGE_FAIL(12,"兑换失败",true),
    ADD_BALANCE_ENTRY(13,"余额录入添加",true),
    SUB_BALANCE_ENTRY(14,"余额录入减去",false),
    SUB_GIVE_FEE(15,"转赠手续费",false),
    LOTTERY(16,"轮盘抽奖",true),
    TASK(17,"任务奖励",true),
    IP_MALL_BUY(18,"IP商城购买",false),
    DECOMPOSE(19,"分解",true),
    ACTIVITY_TASK(20,"活动任务",true),
    GUESSING_GAME(21,"竞猜活动",true),
    BOX_EXCHANGE(22,"兑换盲盒",false),
    GIFT(23,"转赠道具卡",false),
    BOX_AWARD(24,"盲盒奖励",true),
    PROPS_EXCHANGE(25,"积分兑换道具卡",false),
    SAAS_TASK_AWARD(26,"saas任务奖励",true),
    GIVE_MATE_WALLET(27,"转增到玛特钱包",false),
    SIGN_IN_ACTIVITY(28,"签到活动",true),
    ;


    @EnumValue
    private Integer code;
    private String name;
    private boolean isAdd;

    public static String getValue(Integer code) {
        AssetChangeLogEnum[] values = values();
        for (AssetChangeLogEnum v : values) {
            if (v.getCode().equals(code)) {
                return v.getName();
            }
        }
        return null;
    }


    public static List<Integer> getCodeListByIsAdd(boolean isAdd){
        List<Integer> list = Lists.newArrayList();
        AssetChangeLogEnum[] values = values();
        for (AssetChangeLogEnum v : values) {
            if (v.isAdd == isAdd) {
                list.add(v.getCode());
            }
        }
        return list;
    }

}
